drop FUNCTION [dbo].udf_percent
go

CREATE FUNCTION [dbo].udf_percent ( @x money, @y money)
RETURNS int
AS

BEGIN  
	if ( @y = 0 )
		return 0

	return round ( @x * 100.0 / @y, 0 )
END

/*

select dbo.udf_percent ( 3, 7 )

*/